﻿Public Class frmKQTD
    Dim _vd As New dsVong
    Dim _tk As New TimKiem
    Dim _clb As New dsCLB
    Public _matranGlobal As Integer


    
    Private Sub frmKQTD_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Me.Cursor = Cursors.AppStarting
        dgvKQTD.DataSource = _tk.TimKiemKQTD(1, 0)

        'Load vong dau vao combobox
        cbTKVong.DataSource = _vd.LayDSVong()
        cbTKVong.DisplayMember = 0
        cbTKVong.ValueMember = "Vong"

        'Load clb vao combobox
        cbDoiBong.DataSource = _clb.LayDoiBongTK()
        cbDoiBong.DisplayMember = "TenCLB"
        cbDoiBong.ValueMember = "MaCLB"

        Me.Cursor = Cursors.Default

    End Sub
    Dim _vongIndex, _clbIndex As Integer

  
    Private Sub dgvKQTD_CellMouseDoubleClick(sender As Object, e As DataGridViewCellMouseEventArgs) Handles dgvKQTD.CellMouseDoubleClick
        If e.RowIndex >= 0 AndAlso e.ColumnIndex >= 0 Then
            Dim selectedRow = dgvKQTD.Rows(e.RowIndex)
            _matranGlobal = selectedRow.Cells(1).Value
            Dim f As New frmDSGB(_matranGlobal)
            f.ShowDialog()
        End If
    End Sub

    Private Sub cbTKVong_SelectionChangeCommitted_1(sender As Object, e As EventArgs) Handles cbTKVong.SelectionChangeCommitted, cbDoiBong.SelectionChangeCommitted
        _vongIndex = cbTKVong.SelectedValue
        _clbIndex = cbDoiBong.SelectedValue
        dgvKQTD.DataSource = _tk.TimKiemKQTD(_vongIndex, _clbIndex)
    End Sub
End Class